package com.demo.jwt.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class MyExceptionAdvice {

    @ExceptionHandler(MyException.class)
    @ResponseBody
    public ResponseVo myExceptionHandler(MyException e){
        return ResponseVo.buildException(e);
    }

    /**
     * 处理系统异常
     */
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public ResponseVo defaultException(Exception e){
        return ResponseVo.build(RespStatus.ERROR,"");
    }
}
